Option Explicit

Dim p4, arr, str, info, errs, warns

Set p4 = WScript.CreateObject("P4COM.p4")

p4.port = "1666"
p4.client = "bruno_ws"
p4.ExceptionLevel = 0
p4.connect

p4.input = "Password"
DisplayResult("login")

DisplayResult("info")
DisplayResult("describe 1234")
DisplayResult("describe 704")

p4.disconnect
p4.Tagged
p4.connect
DisplayResult("describe 704")

sub PrintArray(msg, arr)
    if (UBound(arr) >= 0) then
        WScript.Echo(msg & join(arr, chr(13) & chr(10)))
    end if
end sub

sub DisplayResult(cmd)
    WScript.Echo("Cmd: " & cmd)
    PrintArray "Info: ", p4.run_variant(cmd)
    PrintArray "Warnings: ", p4.Warnings_variant
    PrintArray "Errors: ", p4.Errors_variant
end sub

